
import http from "../httpService";
import { MySearchLogQueryDto } from "./dto/mySearchLogQueryDto";

class SearchLogService {
    public async getMySearchLogs(input: MySearchLogQueryDto) {
        return await http.get('/api/services/app/SearchLog/GetMySearchLogsAsync', input)
    }

    public async deleteSearchLog(id: number) {
        return await http.delete('/api/services/app/SearchLog/DeleteSearchLogAsync', { id: id })
    }

    public async createLogs(obj: object) {
        return await http.post('/api/services/app/SearchLog/CreateOrUpdateSearchLogAsync', obj)
    }

    public async deleteAll(moduleTypeId: string) {
        let url_ = '/api/services/app/SearchLog/DeleteAllAsync?'
        if (moduleTypeId !== undefined)
            url_ += "moduleTypeId=" + encodeURIComponent("" + moduleTypeId) 
        return await http.delete(url_, {})
    }
}

export default new SearchLogService()